package com.maiji.cloud.response.shopingmall;

import com.maiji.cloud.entities.shopingmall.ShipmentsInfoEntity;
import com.maiji.cloud.response.login.UserInfoResData;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.eclipse.jetty.util.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;

@NoArgsConstructor
@Data
@Accessors(chain=true)
public class ShopingOrderResData {

    @ApiModelProperty(value="订单ID")
    private String uuId;

    @ApiModelProperty(value="用户ID")
    private String userId;

    @ApiModelProperty(value="订单编号")
    private String orderNo;

    @ApiModelProperty(value="配送方式")
    private String delivery;

    @ApiModelProperty(value="配送费")
    private Double deliveryFee;

    @ApiModelProperty(value="配送信息[]")
    private List<DeliveryResData> deliveryList;

    @ApiModelProperty(value="订单商品总重(克)")
    private Integer weightTotal;

    @ApiModelProperty(value="买家备注")
    private String remarks;

    @ApiModelProperty(value="卖家备注")
    private String sellerRemarks;

    @ApiModelProperty(value="使用减肥基金")
    private Double fund;

    @ApiModelProperty(value="使用积分")
    private Integer integral;

    @ApiModelProperty(value="使用积分兑换购物金额")
    private Double integralMoney;

    @ApiModelProperty(value="优惠卷兑换记录ID")
    private String exchangeId;

    @ApiModelProperty(value="优惠券金额")
    private Double coupon;

    @ApiModelProperty(value="购物商品总金额")
    private Double scAmount;

    @ApiModelProperty(value="订单金额")
    private Double amount;

    @ApiModelProperty(value="支付方式：0-砍价免费拿，1-余额支付，2-微信支付 ，3-支付宝支付，4，积分兑换")
    private Integer payType;

    @ApiModelProperty(value="支付交易号")
    private String payId;

    @ApiModelProperty(value="创建时间")
    private Date createDate;

    @ApiModelProperty(value="付款时间")
    private Date payDate;

    @ApiModelProperty(value="打印时间")
    private Date printDate; //

    @ApiModelProperty(value="发货时间")
    private Date sendDate;

    @ApiModelProperty(value="收货时间")
    private Date receiveDate;

    @ApiModelProperty(value="完成时间")
    private Date doneDate;

    @ApiModelProperty(value="取消时间")
    private Date cancelDate;

    @ApiModelProperty(value="取消原因")
    private String cancelReason;

    @ApiModelProperty(value="是否提醒发货")
    private Boolean remindSend;

    @ApiModelProperty(value="是否结算订单返现")
    private Boolean shareOrder;

    @ApiModelProperty(value="订单返现")
    private Double shareOrderMoney;

    @ApiModelProperty(value="订单状态：0-待付款, 1-待发货，2-待收货，3-已收货/待评价，4-已取消，5-已评价，6-订单完成")
    private Integer status;

    @ApiModelProperty(value="是否可退款")
    private Boolean refundable;

    @ApiModelProperty(value="退款状态，-1未申请退款或已撤销退款，0申请退款，1同意，2待退款，3退款中，4退款成功，5拒绝")
    private Integer refundStatus;

    @ApiModelProperty(value="申请退款时间")
    private Date refundDate;

    @ApiModelProperty(value="用户基本信息")
    private UserInfoResData user;

    @ApiModelProperty(value="购物车信息")
    private List<ShopingCartResData> shopingCarts;

    @ApiModelProperty(value="订单打印信息")
    private List<List<ShipmentsInfoEntity>> infoListList;

    @ApiModelProperty(value="收货地址ID")
    private String shopingAddressId;

    @ApiModelProperty(value="收货地址信息")
    private ShopingAddressResData shopingAddress; // 收货地址

    @ApiModelProperty(value="用户账户信息")
    private CapitalMainResData capitalMainResData;
  
    @ApiModelProperty(value="微信预支付返回的相关参数")
    private Map<String, Object> weixinMap;

    @ApiModelProperty(value="退款/售后信息")
    private ShoppingOrderRefundResData refundData;

    @ApiModelProperty(value="订单发货运单号")
    private String expressNos;

    @ApiModelProperty(value="域名")
    private String realmName;

    @ApiModelProperty(value="跳转地址")
    private String resultUrl = "/pages/orderPay/orderPay?uuId=";

    public String getResultUrl() {
        if (StringUtil.isBlank(realmName)) return null;
        return realmName + resultUrl + uuId;
    }

}
